<?php
include_once "header.php";


if(isset($_POST["id"])){
	$kd_sk = $_POST["id"];
	$daftar_unit = new Daftar_unit();
	$unit = $daftar_unit->getAll();
}

$cek_field="";

if (ISSET($_POST["tambah_arsip_sk"])){

	if($_POST["lokasi"]=="" || $_POST['tgl']==""){
	$cek_field="Peringatan: Silahkan isikan seluruh data yang tersedia.";
	
	} else {
		$daftar_arsip = new Daftar_Arsip();
		$arsip = new Arsip();
		$arsip->setKd_surat($_POST['id']);
		$arsip->setPengarsip($_SESSION['nip']);
		$arsip->setUnitPengarsip($_SESSION['unit']);
		$arsip->setLokasi($_POST['lokasi']);
		$arsip->setTgl_pengarsipan($_POST['tgl']);
		$daftar_arsip->addArsipSK($arsip);
		header("Location:detil_sk.php?id=".$_POST["id"]."");
	
	}
}
?>

<div id="container">
	<div id="errorcont">
		<?php echo $cek_field;
		?>
	</div>
	<div id="maincont">
		<?php include_once "menu_samping.php"; ?>
		<div id="mainright">
			<div id="title">
			Surat Masuk > Detil > Rekam Arsip
			</div>
			<div id="body">
			</br>
			<form name="form1" method="POST" action="rekam_arsip_sk.php">
			<input type="hidden" name="tambah_arsip_sk">
			<input type="hidden" name="id" value="<?php echo $kd_sk; ?>">
			<table border=0 cellspacing=0 cellpadding=4 width=100%>		
				
				<tr>
					<td>Lokasi</td>
					<td>:</td>
					<td>
					<textarea name="lokasi" rows=2 cols=75></textarea>
					</td>
				</tr>
				<tr>
					<td>Tanggal Pengarsipan</td>
					<td>:</td>
					<td>
					<input type="text" name="tgl" id="tgl">
					</td>
				</tr>
				<tr>
					<td></td>
					<td></td>
					<td align="right">
					
					<input type="submit" value="Simpan"> 
					<input type="button" value="Batal" onClick="window.location.href='detil_sk.php?id=<?php echo $kd_sk; ?>'">
					
					</td>
				</tr>
	
			</table>
			<br>
			
			</form>
						
			</div>
        </div>
	</div>
</div>
<?php
	include_once "footer.php";
?>

<script type="text/javascript">
	$(function() { 
	$("#tgl").datepicker({dateFormat: "yy-mm-dd",
											buttonImage:'jquery/css/images/calendar.gif',
											buttonImageOnly: true,
											showOn: 'button'
	}); 
	});
</script>

